

export function base64toBlob(base64String: string, mimeType: string, filename: string): Blob {
    // 移除 data URI 前缀
    const base64WithoutPrefix = base64String.split(',')[1];

    // 将 base64 字符串解码为 ArrayBuffer
    const decodedData = atob(base64WithoutPrefix);

    // 创建一个 Uint8Array 来保存解码后的数据
    const arrayBuffer = new ArrayBuffer(decodedData.length);
    const uint8Array = new Uint8Array(arrayBuffer);
    for (let i = 0; i < decodedData.length; i++) {
        uint8Array[i] = decodedData.charCodeAt(i);
    }

    // 根据 ArrayBuffer 创建 Blob 对象
    return new Blob([arrayBuffer], {type: mimeType});
}
